package easier.app.x.window;


import android.app.Dialog;
import android.content.Context;
import android.view.Window;
import androidx.annotation.NonNull;
import easier.app.x.R;

/**
 * 创建一个规范:创建dialog
 * 1.配置style
 * 2.配置window
 */
public class BaseDialog extends Dialog {

    public BaseDialog( Context context ) {

        this( context, R.style.base_dialog );
    }

    public BaseDialog( @NonNull Context context, int themeResId ) {

        super( context, themeResId );
    }

    @Override
    public void show() {

        /* 此处配置window,保证生效 */
        Window window = getWindow();
        if ( window != null ) {
            configWindow( window );
        }

        super.show();
    }

    /**
     * @param window 用于个性化配置window
     */
    protected void configWindow( Window window ) {}
}
